<!DOCTYPE html>
<html lang="{{ page.lang | default: site.lang | default: "en" }}">
{%- include head.html -%}
<body>
{%- include header.html -%}
{%- include collections-bar.html -%}

{% assign collection = site.collections | where: "label", page.collection | first %}
{% assign doc = collection.docs | where: "url", page.url | first %}
<div class="x-content-side-layout x-container">
  <div class="x-left">
    <h3>{{ collection.name }}</h3>
    {% for sec in collection.sections %}
      <div class="x-collection-section">
        <h4>{{sec.name}}</h4>
        {% assign sectionDocs = collection.docs | where: "section", sec.id %}
        <ol>
          {% for sdoc in sectionDocs %}
            {% if sdoc.url == page.url %}
              <li class="active"><a href="{{sdoc.url}}">{{ sdoc.title }}</a></li>
            {% else %}
              <li><a href="{{sdoc.url}}">{{ sdoc.title }}</a></li>
            {% endif %}
          {% endfor %}
        </ol>
      </div>
    {% endfor %}
  </div>
  <div class="x-content">
    <h1><strong>{{ collection.name }} - {{ page.title }}</strong></h1>
    <small>{% if doc.date %}{{ doc.date }}{% endif %}</small>
    {% if doc.translateFrom %}
      <div class="x-translate-tip">
        <h4>译文提示</h4>
        <p><a href="{{ doc.translateFrom }}">本文翻译自这里</a>。你在阅读本文时，本文很可能已经过时了。如果你对自己英语水平还有一点点点点点的自信，<a href="{{ doc.translateFrom }}">建议你直接看原文</a>，使用本文作为对照之用。</p>
      </div>
    {% endif %}
    <article class="x-article">{{ content | inject_anchors }}</article>
  </div>
  <div class="x-right">
    <h3>本文目录</h3>
    {{ content | toc_only }}
  </div>
</div>
{%- include footer.html -%}
</body>
</html>
